package com.qf.six.ssm.controller.ad;

import com.qf.six.ssm.commen.request.AdParam;
import com.qf.six.ssm.commen.request.AdRequestParam;
import com.qf.six.ssm.commen.vo.ResponseResult;
import com.qf.six.ssm.entity.AdManager;
import com.qf.six.ssm.service.ad.AdService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ZL
 */
@RestController
@RequestMapping("/ad")
public class AdController {
    @Resource
    AdService adService;
    @GetMapping("/list")
    public ResponseResult<List<AdManager>> list(){

        return ResponseResult.success(adService.getList());
    }
    @GetMapping("/add")
    public ResponseResult<Integer> add(AdParam param){
        return ResponseResult.success(adService.addAd(param));
    }
    @PostMapping("/list/select")
    public ResponseResult<List<AdManager>> adList(AdRequestParam param){
        return ResponseResult.success(adService.selectList(param));
    }
}
